<template>
  <div class="processComp">
    <div class="stepBox" v-if="stepBoxs">
      <Steps :stepArr="stepArr" :isUser="isUser" pageType="change" :objOid="objOid" v-if="stepArr.length>0"></Steps>
      <a-empty v-else description="暂无流程视图" class="nodata" style="margin-bottom: 20px"/>
    </div>
    <process-tables :tableData="tableArrLists" class="tableBox" v-if="processTableIsShows"></process-tables>
  </div>
</template>
<script>
import Steps from "@comp/processCommon/approveProcess/stepComp";
import { getDisposeStatus } from "@/api/fileSingle.js"
import processTables from "@comp/processCommon/approveProcess/processTable";
export default{
  components: {
    Steps,
    processTables,
  },
  data() {
    return {
      stepBoxs: true,
      tableArrLists: [],
      processTableIsShows: true,
    }
  },
  props: {
    stepArr:{
      type: Array,
      default:[],
    },
    objOid:{
      type: String,
      default: ""
    },
    isUser: {
      type: [Boolean, String],
      default: false
    },
  },
  mounted() {
    this._getDisposeStatus()
  },
  methods: {
    // 获取流程信息表格
    _getDisposeStatus() {
      this.tableArrLists = [{"workCompletedBy":"","workAssignee":"王志伟","workComments":"","workCompletedDate":"","workName":"流程监控任务","workVote":""},{"workCompletedBy":"王志伟","workAssignee":"王志伟","workComments":"","workCompletedDate":"2022-03-16 15:35:26","workName":"提交","workVote":""},{"workCompletedBy":"","workAssignee":"王志伟","workComments":"","workCompletedDate":"","workName":"初审","workVote":""}];
      return false;
      let paramInfo = { oid:sessionStorage.getItem('changeOid')}
      getDisposeStatus(paramInfo).then(results => {
        if(results.status === 200) {
          if(results.data.data && results.data.success) {
            this.tableArrLists = _.orderBy(results.data.data, ['workCompletedDate'], ['desc'])//按照创建时间降序排序
            this.tableArrLists.splice(0, 0, this.tableArrLists[this.tableArrLists.length - 1])      //把最后一个元素复制到首个
            this.tableArrLists.splice(-1, 1);       //删除最后一个元素
          }else {
            this.tableArrLists = []
          }
        }else {
          this.$message.error('接口失败！')
        }
      })
    },
  }
}
</script>
<style scoped lang="less">
.stepBox{
 padding: 24px 0;
}
.bottomBox{
  margin: 24px 0;
}
</style>